import eslintPlugin from 'vite-plugin-eslint';

import type { Plugin } from 'vite';

export const configEslintPlugin = (): Plugin =>
  eslintPlugin({
    // Decrease execution time, Beta Cache now correctly recognizes file changes, you can try it out.
    cache: false,
    // Auto fix source code.
    fix: true,

    // Path to eslint instance that will be used for linting.
    // eslintPath,

    // Check all matching files on project startup, too slow, turn on discreetly.
    lintOnStart: false,
    // A single file, or array of files, to include when linting.
    include: ['src/**/*.js', 'src/**/*.vue', 'src/**/*.ts'],
    // A single file, or array of files, to exclude when linting.
    exclude: ['/node_modules/'],
    // The errors found will be printed.
    emitError: true,
    // The warings found will be printed.
    emitWarning: true,
    // Will cause the module build to fail if there are any warnings, based on emitWarning.
    failOnWarning: false,
    // Will cause the module build to fail if there are any errors, based on emitError.
    failOnError: false,
  });
